package fr.afcepf.atod.gestionVP.services;

import java.util.Collection;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import fr.afcepf.atod.gestionVP.dao.IDaoNoteFrais;
import fr.afcepf.atod.gestionVP.data.NoteDeFrais;

@Service("serviceNoteFrais")  
@Transactional(rollbackFor=ExceptionGeneral.class) 
public class ServiceNoteFrais implements IServiceNoteFrais {
	
	@Autowired
	IDaoNoteFrais noteDeFrais = null; 
	
	public void setNoteDeFrais(IDaoNoteFrais noteDeFrais) {
		this.noteDeFrais = noteDeFrais;
	}

	public void creerNoteFrais(NoteDeFrais nf) {
		this.noteDeFrais.createNoteFrais(nf);
	}
	
	public void supprimerNoteFrais(int id) {
		this.noteDeFrais.deleteNoteFrais(id);	
	}
	
	public void majNoteFrais(NoteDeFrais nf) {
		this.noteDeFrais.updateNoteFrais(nf);
	}
	
	public Collection<NoteDeFrais> getToutNoteFrais(int id) {
		return this.noteDeFrais.getAllNoteFrais(id);
	}
	
	public NoteDeFrais getNoteFraisViaId(int id) {
		return this.noteDeFrais.getNoteFraisById(id);
	}

	public IDaoNoteFrais getNoteDeFrais() {
		return noteDeFrais;
	}
	
	
}
